/*
######################################################################################################
#                                                                                                    # 
#	This page shows the Link To Button a dentist based on the 'id' passed in the querystring          # 
#	Author:Deepak
#	Date:  Jan 16,2008                                                                             # 
#	                                                                                                 # 
######################################################################################################
*/

using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using SiteManager;

public partial class Dentist_LinkToProfile : System.Web.UI.Page
{
    #region Local Variable
    Manager objMng;
    int DentID = 0;
    #endregion

    #region Page Load
    protected void Page_Load(object sender, EventArgs e)
    {
        localFunction obj = new localFunction();
        obj.checkDentistLogin(true); 
        
        GetDentID();//Get Dentid
        string strGetDentName = string.Empty;
        txtbtnScript.ReadOnly = true;
        txtbtnScript1.ReadOnly = true;
        txtbtnScript2.ReadOnly = true;
        txtbtnScript3.ReadOnly = true;
        if (!IsPostBack)
        {
            //Comented for implement new URL Formate at 17/07/08 by Ranjeet 

            //strGetDentName = GetDentName(DentID.ToString());//Get Doctor Name
            //txtbtnScript.Text = "<a href=\"" + Session["strHttp"].ToString() + "dentist/DentistDetails.aspx?id=" + DentID + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_myprofile_160x33.gif\" width=\"160\" height=\"33\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
            //txtbtnScript1.Text = "<a href=\"" + Session["strHttp"].ToString() + "dentist/DentistDetails.aspx?id=" + DentID + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_viewmy_160x33.gif\" width=\"160\" height=\"33\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
            //txtbtnScript2.Text = "<a href=\"" + Session["strHttp"].ToString() + "dentist/DentistDetails.aspx?id=" + DentID + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_viewmy_160x25.gif\" width=\"160\" height=\"25\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
            //txtbtnScript3.Text = "<a href=\"" + Session["strHttp"].ToString() + "dentist/DentistDetails.aspx?id=" + DentID + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_viewmy_120x33.gif\" width=\"120\" height=\"33\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";

            string dentdetailslink = "";
            dentdetailslink = HttpContext.Current.Session["strHttp"] + "dentists/" + obj.GetURLFormatById(DentID, "dentist") + "/" + DentID.ToString() + "-" + GetDentName(DentID.ToString()) + ".aspx";

            strGetDentName = GetDentName(DentID.ToString());//Get Doctor Name
            txtbtnScript.Text = "<a href=\"" + dentdetailslink + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_myprofile_160x33.gif\" width=\"160\" height=\"33\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
            txtbtnScript1.Text = "<a href=\"" + dentdetailslink + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_viewmy_160x33.gif\" width=\"160\" height=\"33\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
            txtbtnScript2.Text = "<a href=\"" + dentdetailslink + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_viewmy_160x25.gif\" width=\"160\" height=\"25\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
            txtbtnScript3.Text = "<a href=\"" + dentdetailslink + "\"><img src=\"" + Session["strHttp"].ToString() + "images/btn_viewmy_120x33.gif\" width=\"120\" height=\"33\" border=\"0\" alt=\"View " + GetDentName(DentID.ToString()) + " profile on Find a Doc\" /></a>";
        }
    }
    #endregion

    #region Get DentistId from Query String
    public void GetDentID()
    {
        if (Request.QueryString["id"].ToString() != "" && Request.QueryString["id"] != null)
        {
            DentID = Convert.ToInt32(Request.QueryString["id"]);
        }
        else
        {
            DentID = 0;
        }
    }
    #endregion

    #region Get The Doctor Name By DoctorId
    public string GetDentName(string DoctID)
    {
        objMng = new Manager(true,"ConnectionString");
        //Inline query to get doctor name by passing docID
        string strquery = "Select (FName + ' ' + MName + ' ' + LName) as Name from tbl_Dentists where Id = " + DoctID;
        string strName = objMng.ExecuteScalarQuery(strquery).ToString();
        return strName;
        //    objMng = null;
    }
    #endregion
}
